package com.kayden.book.enums;

import org.springframework.web.client.HttpClientErrorException;

public enum BookStatusEnum {

    DELETED(0,"删除"),
    NORMAL(1,"正常"),
    FORBIDDEN(2,"不可借阅");
    private int code;
    private String desc;

    BookStatusEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static BookStatusEnum getStatusByCode(int code) {
        switch (code){
            case 0: return BookStatusEnum.DELETED;
            case 1: return BookStatusEnum.NORMAL;
            case 2: return BookStatusEnum.FORBIDDEN;
            default: return null;
        }
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

}
